﻿using System.Linq;
using Journal.Domain.Models;

namespace Journal.Admin.Presentation.Models.LoginModels
{
    public class SuccessLoginModel
    {
        public SuccessLoginModel(User user)
        {
            Login = user.Login;
            PermissionId = user.Permissions.Count == 0 ? 0 : user.Permissions.First().Id;
            FullName = string.Format("{0} {1}", user.UserInfo.Name, user.UserInfo.Surname);
            Id = user.Id;
        }

        public int Id { get; set; }

        public string FullName { get; set; }

        public string Login { get; set; }

        public int PermissionId { get; set; }
    }
}